<template>
  <el-select
    v-model="nv[fvData.fdName]"
    placeholder="Select"
    size="large"
    style="width: 240px"
    clearable
    v-if="nv"
  >
    <el-option
      v-for="item in options"
      :key="item.code"
      :label="item.description"
      :value="item.code"
    />
  </el-select>
</template>

<script>
import { ref, computed, onMounted } from 'vue'
import cacheManage from '../../cache/CacheManage'

export default {
  name: 'FvSelect',
  props: {
    fvData: {
      default: null,
      type: Object
    }
  },
  setup(props) {
    const nv = computed(() => {
      return props.fvData.getNv();
    });
    const options = ref();
    onMounted(async() => {
      const mdCode = props.fvData.fdLayout.mdCode;
      const mvs = await cacheManage.getMvs(mdCode);
      options.value = mvs;
    });
    return {
      nv,
      options
    }
  }
}
</script>

<style scoped>

</style>
